<?php
namespace app\mobile\controller;

use app\model\Theme; 
use app\model\Worker; 

class WSetmobile extends Base
{
    public function W_setmobile()
    {
global $_G, $_P;
$fans = $this->checkuser();
$themeid = intval($_P['themeid']);
if($themeid < 0){
	return_msg('管理后台地址不正确');
}
$system=$_G['system'];
$theme = Theme::getThemeById($themeid);
$config = 	Theme::getConfig($themeid);
if(empty($theme['id'])){
	return_msg('管理后台地址不正确');
}
$myworker = Worker::getThemeWorkerByOpenidNew($_G['openid'],$themeid);
if(!($system['ruanjian']!=3 || $config['showshop']==0 || ($system['ruanjian']==3 && $config['showshop']==$myworker['company']))){
	$myworker = "";
}
if (empty($myworker)) {
	return_msg('您不是员工,无权访问');
}
$msg = Worker::gethoutaistats();
if (!empty($msg)) {
	return_msg($msg);
}
$do = 'order';
$op = !empty($_P['op']) ? $_P['op'] : 'display';
$id = intval($_P['id']);

if ($op=='display') {

}elseif ($op=='save'){

    $config_old = $config;
    
	$config['workerpass'] = $_P['workerpass'];
	$config['isreport'] = intval($_P['isreport']);
	$config['isrank'] = intval($_P['isrank']);
	$config['isshoprank'] = intval($_P['isshoprank']);
	$config['isxianxia'] = intval($_P['isxianxia']);
	$config['isshowxianxia'] = intval($_P['isshowxianxia']);
	$config['iseditorder'] = intval($_P['iseditorder']);
	$config['examplestyle'] = intval($_P['examplestyle']);
	$config['isexampleqr'] = intval($_P['isexampleqr']);
	
	writelog($id,'手机编辑',$config_old,$config,$myworker['username']);
	Theme::setConfig($config,$themeid,$_G['mpid']);
    return_msg('更新成功','','success');
}
    
if($_G['companyname'] =='新飞驰软件'){
	$return_clicent = get_defined_vars();
return view('/fcworker/fc_setmobile' , $return_clicent);
}else{
	$return_clicent = get_defined_vars();
return view('/yxworker/w_setmobile' , $return_clicent);
}
}
}